/* 自定义管理后台样式 */

/* 侧边栏样式优化 */
.sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-right: none;
}

.sidebar .nav-link {
    color: #ecf0f1 !important;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: #3498db !important;
    color: white !important;
    transform: translateX(5px);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* 统计卡片样式优化 */
.stat-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.stat-card .card-body {
    padding: 2rem 1.5rem;
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* 表格样式优化 */
.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

/* 按钮样式优化 */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* 卡片样式优化 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* 表单样式优化 */
.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* 分页样式优化 */
.pagination .page-item.active .page-link {
    background-color: #3498db;
    border-color: #3498db;
}

.pagination .page-link {
    color: #3498db;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
}

.pagination .page-link:hover {
    color: #2c3e50;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* 徽章样式优化 */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* 搜索表单样式 */
.search-form .input-group {
    border-radius: 0.375rem;
    overflow: hidden;
}

.search-form .form-control {
    border-right: none;
}

.search-form .btn {
    border-left: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        min-height: auto;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stat-card .card-body {
        padding: 1.5rem 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图片预览样式 */
.image-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0.25rem;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.image-preview-item:hover {
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-image,
.image-preview-item .remove-existing-image {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-item .remove-image i,
.image-preview-item .remove-existing-image i {
    font-size: 14px;
    line-height: 1;
}

/* 图片上传区域 */
#image_preview {
    min-height: 100px;
    padding: 0.5rem;
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

#image_preview:empty::before {
    content: "暂无图片，点击上方按钮选择图片";
    color: #6c757d;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 2rem;
}

/* 旋转动画 */
.spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* 主图选择器样式 */
.main-image-option {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    margin: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-image-option:hover {
    border-color: #0d6efd;
    transform: scale(1.05);
}

.main-image-option.selected {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.main-image-option img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.selected-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: #0d6efd;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* 主图选择器容器 */
#main_image_selector {
    min-height: 80px;
    padding: 0.5rem;
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

#main_image_selector:empty::before {
    content: "请先上传图片";
    color: #6c757d;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 2rem;
}

/* 自定义颜色 */
.text-primary {
    color: #3498db !important;
}

.bg-primary {
    background-color: #3498db !important;
}

.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}
